import { PORT3 } from "@/api/config/servicePort";
import http from "@/api";
import { Receive } from "../interface/receive";
import { defaultParams } from "@/interface/public";

const PORT = `${PORT3}/receive`;

// 保存来料主信息
export const receiveSave = (params: Receive.ReqSave) => http.post(PORT + `/save`, params);

// 来料单查询
export const receivePage = (params: Receive.ReqSearch) => http.post<Receive.ResSearch>(PORT + `/page`, params);

// 收货单状态提交
export const receiveCommit = (params: defaultParams) => http.post(PORT + `/commit/${params.id}`);

// 删除来料主信息
export const receiveDelete = (params: defaultParams) => http.post(PORT + `/remove/${params.id}`);

// 查询来料单明细列表
export const receiveListItem = (params: defaultParams) => http.get<Receive.ResSearchDetail[]>(PORT + `/itemList/${params.id}`);

// 保存来料明细
export const receiveSaveItem = (params: Receive.ReqSaveDetail) => http.post<Receive.ResSearchDetail>(PORT + `/saveItem`, params);

// 删除来料明细
export const receiveRemoveItem = (params: defaultParams) => http.post(PORT + `/removeItem/${params.id}`);
